<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
    <title>单据确认</title>
</head>
<body>
<script type="text/javascript">
    var danJuQueRen;
    $(function() {
    	danJuQueRen = $('#dataGrid').datagrid({
            url : '${pageContext.request.contextPath}/business/accounting/danjuqueren/list.shtml',
            fit : true,
            border : false,
            pagination : true,
            idField : 'id',
            pageSize : 20,
            pageList : [ 10, 20, 30, 40, 50 ],
            sortName : 'ID',
            sortOrder : 'ASC',
            checkOnSelect : false,
            selectOnCheck : false,
            nowrap : false,
            striped : true,
            rownumbers : true,
            singleSelect : true,
            columns : [ [{
                field : 'ID',
                title : '序号',
                width : 100,
                hidden : true
            },{
                field : 'ZHAIYAO',
                title : '摘要',
                width : 100,
                sortable : true
            },{
                field : 'YWLX',
                title : '业务类型',
                width : 100,
                sortable : true
            },{
                field : 'JFFSE',
                title : '借方发生额',
                width : 100,
                sortable : true
            }, {
                field : 'DFFSE',
                title : '贷方发生额',
                width : 100,
                sortable : true
            }, {
                field : 'FJDJS',
                title : '附件单据数',
                width : 100,
                sortable : true
            }, {
                field : 'JZRQ',
                title : '记账日期',
                width : 100,
                sortable : true
            }, {
                field : 'ZD',
                title : '制单',
                width : 100,
                sortable : true
            }
            , {
                field : 'FH',
                title : '复核',
                width : 100,
                sortable : true
            }
            , {
                field : 'JZ',
                title : '记账',
                width : 100,
                sortable : true
            }
            , {
                field : 'HZPZH',
                title : '汇总凭证号',
                width : 100,
                sortable : true
            }, {
                field : 'PZZTBS',
                title : '凭证状态标识',
                width : 100,
                sortable : true
            }, {
                field : 'ZZBS',
                title : '制作标识',
                width : 100,
                sortable : true
            }, {
                field : 'PZLB',
                title : '凭证类别',
                width : 100,
                sortable : true
            }
            , {
                field : 'XSPZH',
                title : '显示凭证号',
                width : 100,
                sortable : true
            },
            {
                field : 'action',
                title : '操作',
                width : 100,
                formatter : function(value, row, index) {
                    var str = '';
                    str += $.formatString('<a onclick="chakan(\'{0}\',\'{1}\');" src="{2}" >查看</a>',row.XSPZH,row.HZPZH);
                    return str;
                }
            }
            ]],
            toolbar : '#toolbar',
            onLoadSuccess : function() {
                $('#zdpzglsearchForm table').show();
                parent.$.messager.progress('close');
                $(this).datagrid('tooltip');
            },
            onRowContextMenu : function(e, rowIndex, rowData) {
                e.preventDefault();
                $(this).datagrid('unselectAll');
                $(this).datagrid('selectRow', rowIndex);
                $('#menu').menu('show', {
                    left : e.pageX,
                    top : e.pageY
                });
            }
        });

        console.info(danJuQueRen);
        danJuQueRen.datagrid('resize');
    });

    $('#pzcx_query_form_search_button').click(function () {
        $('#pzcx_query_form').submit();
        var data = $('#zdpzglsearchForm').serialize();
        $.ajax()
    });

    $('#hsdw').combobox({
        url:'${pageContext.request.contextPath}/business/accounting/zdpzgl/hsdw.shtml',
        valueField:'ID',
        textField:'TITLE'
    });
    $('#cwzt').combobox({
        url:'${pageContext.request.contextPath}/business/accounting/zdpzgl/cwzt.shtml',
        valueField:'ZTDM',
        textField:'ZTMC'
    });
    function searchFun() {
    	danJuQueRen.datagrid('load', $.serializeObject($('#zdpzglsearchForm')));
    }
    function cleanFun() {
        $('#zdpzglsearchForm input').val('');
        danJuQueRen.datagrid('load', {});
    }

    function xiugai() {
        var row = $('#dataGrid').datagrid('getSelections');
        var id = row[0].ID;
            parent.$.modalDialog({
                title : '修改',
                width : 780,
                height : 500,

                href : '${pageContext.request.contextPath}/business/accounting/danjuqueren/editPage.shtml?ID='+id, 
             /*    href : '${pageContext.request.contextPath}/business/accounting/danjuqueren/addFjdjs.shtml?id='+id, */
                buttons : [ {
                    text : '确认',
                    handler : function() {
                        parent.$.modalDialog.openner_dataGrid = dataGrid;//因为修改成功之后，需要刷新这个dataGrid，所以先预定义好
                        var f = parent.$.modalDialog.handler.find('#form');
                        f.submit();
                    }
                } ]
            });
    } 
    
    function chakan(XSPZH,HZPZH){
        $('#ck_ck_window').window({
            title:'凭证附件',
            width:1050,
            height:500,
            href : '${pageContext.request.contextPath}/business/accounting/danjuqueren/viewPage.shtml?XSPZH='+XSPZH+'&HZPZH='+HZPZH,
            modal:true
        });

    }

</script>
<div class="easyui-layout" data-options="fit : true,border : false">
    <div data-options="region:'north',title:'',border:false" style="height: 100px; overflow: hidden;" >
        <form id="zdpzglsearchForm">
            <table class="form_view_border" bordercolordark="#FFFFFF" bordercolorlight="#45b97c" border="px" cellpadding="0" cellspacing="0" style="">
                <tr>
                    <th class="panel-header">核算单位</th>
                    <td style="width: 160px">
                        <input class="easyui-combobox" id="hsdw" name = "HSDW_EQ_STR" style="width: 190px;height: 27px;" data-options="valueField:'ID', textField:'TITLE', panelHeight:'auto'" >
                    </td>
                    <th class="panel-header">财务账套</th>
                    <td style="width: 160px">
                        <input class="easyui-combobox" id="cwzt" name = "ZTDM_EQ_STR" style="width: 190px;height: 27px;" data-options="valueField:'ZTDM', textField:'ZTMC', panelHeight:'auto'" >
                    </td>
                </tr>
                <tr>
                    <th class="panel-header">记账日期</th>
                    <td><input  name="JZRQ_EQ_DATE_yyyyMMdd"
                                class="form_view_input combo easyui-datebox"/></td>
                    <th class="panel-header">至</th>
                    <td><input  name="JZRQ_END_DATE_yyyyMMdd"
                                class="form_view_input combo easyui-datebox"/></td>
                </tr>
            </table>
        </form>
    </div>
    <div data-options="region:'center',border:false">
        <table id="dataGrid"></table>
    </div>
</div>
<div id="toolbar" style="display: none;">
    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_add',plain:true" onclick="searchFun();">查询</a>
    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_delete',plain:true" onclick="cleanFun();">重置</a>
    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_delete',plain:true" onclick="xiugai();">修改附件单据数</a>
</div>
<div id="ck_ck_window"></div>
</body>
</html>
="ck_ck_window"></div>
</body>
</html>
